<template>
	<view>

		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<view class="u-m-r-10 avatar-body">
				<!-- <oss-upload></oss-upload> -->		
				<u-avatar :src="vuex_user.avatarUrl"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20">昵称:
					{{vuex_user.nickName}}
				</view>
				<view class="u-font-14 u-tips-color">手机号:
					<!-- {{vuex_user.email}} -->
				</view>
			</view>

		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="setting" title="个人信息" @click='toBaseInfo'></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="所有订单"></u-cell-item>
				<u-cell-item icon="star" title="xxx1"></u-cell-item>
				<u-cell-item icon="map" title="xxx2"></u-cell-item>
			</u-cell-group>
		</view>

		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="reload" title="退出登录" @click="logout"></u-cell-item>
			</u-cell-group>
		</view>
		<button @click="getUserProfile" > 获取头像昵称 </button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true
			}
		},
		onLoad() {

		},
		methods: {
			toBaseInfo() {
				this.$u.route({
					url:'pages/center/baseInfo'
				})
				
			},
			logout() {
				// this.$u.api.Logout();
				// this.$u.toast('退出成功');
				// setTimeout(()=>{
				// 	this.$u.vuex('vuex_token',null);
				// 	this.$u.vuex('vuex_user',{});
				// },1500)
				// this.$u.route({
				// 	type:'reLaunch',
				// 	url:'pages/auth/login'
				// })
				// console.log(this.$u.vuex('vuex_user',{}))
			},
			getUserProfile(){
						const that=this;
						uni.getUserProfile({
							desc: "注册",
							success: (res1) => {
								console.log(res1);
								console.log(that);
								that.$u.vuex('vuex_user',res1.userInfo);
								// _this.check()
								// _this.getCode()
							},
							fail: (err) => {
								console.log(err)
							}
						})	
					},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ededed;
	}

	.camera {
		width: 108rpx;
		height: 88rpx;

		&:active {
			background-color: #ededed;
		}
	}

	.user-box {
		background-color: #fff;
		padding-top: 20rpx;
	}

	.avatar-body {
		
	}
</style>
